#! /bin/sh

# --- Example shell for refRealHTI.c
# --- real reflection coefficients
# --- for interfaces between two HTI
# --- media with throughgoing symmetry
# --- planes. Coefficients can be computed
# --- at arbitrary azimuthal direction

# --- Input parameters are Thomsen parameters
# --- (i.e., anisotropy parameters defined 
# --- with respect to the symmetry axis)
# 
# --- Andreas Rueger, CWP Feb21, 1997

# Isotropic overburden
vp1=3.67 vs1=2.0 rho1=2.41 

# Reflector (uncracked)
vp2=4.5 vs2=2.53 rho2=2.8

# Compute P-P reflection coeff.
modei=0 modet=0 rort=1

#incident angles
fangle=0 langle=40 dangle=1

#azimuth of survey line
azimuth=70

#output-format / testing
iscale=0 ibin=1 test=1 info=0


# outpar files
rm outpar1 outpar2
outpar1=outpar1 outpar2=outpar2

# coefficient files
coeffile1=coeff1.bin coeffile2=coeff2.bin

# Path to executables
#B=${HOME}/Release/bin

## plotting parameters -cosmetics
width=500       height=500
d1num=          d2num=
marksize=0 style=normal linewidth=3
label1="Incidence angle (degree)" 
label2="Reflection coefficient" 

# reflection coefficients uncracked 
refRealAziHTI  modei=$modei modet=$modet rort=$rort \
	fangle=$fangle langle=$langle dangle=$dangle \
	iscale=$iscale ibin=$ibin \
	outparfile=$outpar1 coeffile=$coeffile1 \
	vp1=$vp1 vs1=$vs1 rho1=$rho1 \
	delta1=0 eps1=0  gamma1=0\
	vp2=$vp2 vs2=$vs2 rho2=$rho2 \
	delta2=0 eps2=0  gamma2=0\
	test=$test info=$info azimuth=$azimuth

n1=`cat $outpar1`

xgraph <$coeffile1 n=$n1 linecolor=2 \
        width=$width height=$height \
        d1num=$d1num d2num=$d2num\
        linewidth=$linewidth marksize=$marksize \
        label1=$label1 label2=$label2 \
        style=$style title="Uncracked, azimuth=$azimuth" &


# reflection coefficients with cracked reflector
# Crack density=0.07 aspect ratio=0.001 gas filling
# Parameters can be computed with Hudson's equation
# type
# hudson vp=4.5 vs=2.53 rho=2.8 aspect=0.001 cdens=0.07 
#
vp2=3.67982 vs2=2.33853 rho2=2.8  
gamma2=0.085227 eps2=0.214212 delta2=0.201382  


refRealAziHTI  modei=$modei modet=$modet rort=$rort \
	fangle=$fangle langle=$langle dangle=$dangle \
	iscale=$iscale ibin=$ibin \
	outparfile=$outpar2 coeffile=$coeffile2 \
	vp1=$vp1 vs1=$vs1 rho1=$rho1 \
	delta1=0 eps1=0  gamma1=0 \
	vp2=$vp2 vs2=$vs2 rho2=$rho2 \
	delta2=$delta2  eps2=$eps2  gamma2=$gamma2 \
	test=$test info=$info azimuth=$azimuth


n2=`cat $outpar2`

xgraph <$coeffile2 n=$n2  \
        width=$width height=$height \
        d1num=$d1num d2num=$d2num\
        linewidth=$linewidth marksize=$marksize \
        label1=$label1 label2=$label2 linecolor=2 \
        style=$style title="Reflector with gas-filled cracks" &

#merge the curves 
linecolor=2,3
cat $coeffile1 $coeffile2 |
xgraph  n=$n1,$n2  linecolor=$linecolor\
        width=$width height=$height \
        d1num=$d1num d2num=$d2num\
        linewidth=$linewidth marksize=$marksize \
        label1=$label1 label2=$label2 \
        style=$style title="Comparison" &

# clean up

#/bin/rm $coeffile1 $coeffile2 $outpar1 $outpar2

exit



